﻿namespace EAL
{
    using System.Windows;
    using EAL.Database;
    using EAL.Models;
    using EAL.ViewModels;

    /// <summary>
    /// Interaktionslogik für ProductWindow.xaml
    /// </summary>
    public partial class ProductWindow : Window
    {
        private DbContext dbContext;
        private Product product;

        public ProductWindow(DbContext dbContext, ref Product product)
        {
            this.dbContext = dbContext;
            this.product = product;

            InitializeComponent();

            ProductEditingVM vm = new ProductEditingVM();

            vm.DbContext = dbContext;
            vm.Product = product;

            this.DataContext = vm;
        }

        private void SaveButton_Click(object sender, RoutedEventArgs e)
        {
            this.DialogResult = true;

            this.Close();
        }       
    }
}
